package io.buffer;

import org.junit.Test;

import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;

/**
 * @author mubei
 * @date 2021/12/3
 * @description
 */
public class BufferReader_ {

    @Test()
    public void test1() {
        String filePath = "D:\\date\\distable\\practice\\code\\basic\\src\\main\\java\\io\\test.txt";
        BufferedReader bufferedReader = null;
        try {
            bufferedReader = new BufferedReader(new FileReader(filePath));
            //按行读取
            String s;
            while((s = bufferedReader.readLine()) != null){
                System.out.println(s);
            }
        } catch (Exception e) {
            e.printStackTrace();
        }finally{
            try {
                bufferedReader.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }




    }
}
